from django.db import models

# Create your models here.
class ChatOrders(models.Model):
    """
    ChatOrders
    status:
    status: -1:全部。0:未支付。1:已扫码。2:以支付
    """
    id = models.BigAutoField(primary_key=True)
    user_id = models.IntegerField(verbose_name="用户ID", blank=False, null=False)
    product_id = models.IntegerField(verbose_name="产品ID", blank=False, null=False)
    username = models.CharField(verbose_name="用户名称", max_length=64, blank=False, null=False)
    order_no = models.CharField(verbose_name="订单编号", max_length=64, blank=False, null=False)
    trade_no = models.CharField(verbose_name="交易编号", max_length=64, blank=False, null=False, default="0")
    subject = models.CharField(verbose_name="订单名称", max_length=64, blank=False, null=False)
    amount = models.FloatField(verbose_name="订单金额", blank=False, null=False)
    status = models.IntegerField(verbose_name="订单状态", blank=False, null=False, default=0)
    remark = models.JSONField(verbose_name="订单备注", blank=False, null=False, default=dict)
    pay_time = models.DateTimeField(verbose_name="订单时间", null=True, blank=True, default=None)    # 订单时间
    pay_way = models.CharField(verbose_name="支付方式", max_length=16, blank=False, null=False)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    deleted_at = models.DateTimeField(verbose_name="删除时间", null=True, blank=True, default=None)

